package com.zhangwei.day38;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

import com.lidroid.xutils.exception.DbException;
import com.zhangwei.day38.bean.User;
import com.zhangwei.day38.fragment.HttpFragment;

import java.util.List;

/**
 * ormLimte
 * greenDao
 */
public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
//        DbUtils orm框架
        getSupportFragmentManager().beginTransaction().add(R.id.fragment_container, new HttpFragment()).commit();

        User user = new User();
        user.setPwd("123");
        user.setName("wh1501");
        try {
            BaseApp.getInstance().getDbUtils().save(user);
            List<User> list = BaseApp.getInstance().getDbUtils().findAll(User.class);
        } catch (DbException e) {
            e.printStackTrace();
        }

    }

}
